package com.zjj.lbw.designpattern.adapter;

/**
 * @author zhanglei.zjj
 * @description 适配器模式-类适配器
 * @date 2023/7/13 16:49
 */
public class ClassAdapterTest {
    public static void main(String[] args) {
        Adpater2 adpater = new Adpater2();
        adpater.output5v();

    }
}

class Adaptee2 {
    public int output220v() {
        return 220;
    }
}

interface Target2 {
    int output5v();
}

// Class Adapter
class Adpater2 extends Adaptee2 implements Target2 {

    @Override
    public int output5v() {
        int i = output220v();
        //  ......
        System.out.println(String.format("原始电压： %d v  - >  输出电压： %d  v  ", i, 5));
        return 5;
    }
}
